package com.bkaka.service.impl;

import com.bkaka.dao.ExamUserCodeDao;
import com.bkaka.entity.ExamUserCode;
import com.bkaka.service.ExamUserCodeServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * Created by maxiaoqiang on 2018/7/27.
 */
@Service
public class ExamUserCodeServerImpl implements ExamUserCodeServer {

    @Autowired
    private ExamUserCodeDao dao;

    public void create(ExamUserCode userCode) {
        userCode.setCreateTime(new Date().getTime());
        dao.create(userCode);
    }

    public boolean delete(Integer id) {
        return dao.delete(id);
    }

    public ExamUserCode findByNameCode(String username) {
        return dao.findByNameCode(username);
    }

    public void update(Integer id, String code) {
        dao.update(id, code, new Date().getTime());
    }
}
